package cn.it.ygh.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


import cn.it.ygh.mapper.AgentMapper;
import cn.it.ygh.pojo.Agent;
import cn.it.ygh.service.AgentService;

@Service(value = "agentService")
@Transactional
public class AgentServiceImpl implements AgentService{

	@Autowired
	private AgentMapper agentMapper;
	
	public Agent login(Agent ag) {
		Agent agent = agentMapper.login(ag);
		if (agent != null) {
			return agent;
		}

		return null;
	}

	public Agent register(Agent ag) {
		Agent agent = agentMapper.findUser(ag);
		if (agent == null) {
			agentMapper.save(ag);
			return ag;
		}
		return null;
	}
	
	public void update(Agent ag){
		agentMapper.update(ag);
	}
	
	public void updateImg(Agent ag){
		agentMapper.updateImg(ag);
	}
	
	
}
